﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyThietBi.DAL.Models;
using QuanLyThietBi.DAL;

namespace QuanLyThietBi.BLL
{
    public class LichSuThietBiBO
    {
        public int SaveLichSuThietBi(LICHSUTHIETBI tb)
        {
            LichSuThietBiDAO tbDAO = new LichSuThietBiDAO();
            return tbDAO.SaveLichSuThietBi(tb);
        }

        public List<LICHSUTHIETBI> GetAllLichSuThietBi(int thietbiID)
        {
            LichSuThietBiDAO lstb = new LichSuThietBiDAO();
            return lstb.GetAllLichSuThietBi(thietbiID);
        }

        //public string GetTenTinhTrang(int thietbiId)
        //{
        //    ThietBiDAO tbDAO = new ThietBiDAO();
        //    string tinhtrang = string.Empty;
        //    THIETBI thietbi = tbDAO.GetThietBiById(thietbiId);
        //    if (thietbi != null)
        //    {
        //        TinhTrangDAO ttDAO = new TinhTrangDAO();
        //        tinhtrang = ttDAO.GetTinhTrangById(thietbi.tinh_trang);
        //    }
        //    return tinhtrang;
        //}

        //public List<LICHSUTHIETBI> GetAllLichSuThietBi(int thietbiID)
        //{
        //    LichSuThietBiDAO lstb = new LichSuThietBiDAO();
        //    return lstb.GetAllLichSuThietBi(thietbiID);
        //}

        public string GetTenTinhTrang(int thietbiId)
        {
            ThietBiDAO tbDAO = new ThietBiDAO();
            string tinhtrang = string.Empty;
            THIETBI thietbi = tbDAO.GetThietBiById(thietbiId);
            if (thietbi != null)
            {
                TinhTrangDAO ttDAO = new TinhTrangDAO();
                tinhtrang = ttDAO.GetTinhTrangById(thietbi.tinh_trang);
            }
            return tinhtrang;
        }
    }
}
